﻿using BenCaoXuan.Infrastructure.Attr;
using BenCaoXuan.Infrastructure.Dto.Admin.Arrange;
using BenCaoXuan.Service.Interface.admin;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BenCaoXuan.Api.Admin.Controllers.admin
{
    [ApiGroup("Admin(管理端模块)")]
    public class ArrangeController : BaseController
    {
        private readonly I_Arrange_Service _arrange_Service;

        public ArrangeController(I_Login_Service login_Service, I_Arrange_Service arrange_Service) : base(login_Service)
        {
            _arrange_Service = arrange_Service;
        }



        /// <summary>
        /// 管理端-获取排班的员工
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_Arrange_Employee() {
            var result =await _arrange_Service.Get_Arrange_Employee();
            return Ok(result);

        }

        /// <summary>
        /// 管理端-设置排班
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> Set_Arrange([FromBody] SetArrange dto) {
            var result = await _arrange_Service.Set_Arrange(dto.dto);
            return Ok(result);
        }

        /// <summary>
        /// 管理端-获取所有的排班
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_Arrange() {
            var result = await _arrange_Service.Get_Arrange();
            return Ok(result);
        }

        /// <summary>
        /// 管理端-设置员工的休息日
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> Set_EmployeeRestDay(SetRestDay_Dto dto) {
            var result = await _arrange_Service.Set_EmployeeRestDay(dto);
            return Ok(result);
        }

        /// <summary>
        /// 管理端-获取员工休息日
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get_EmployeeRestDay() {
            var result = await _arrange_Service.Get_EmployeeRestDay();
            return Ok(result);
        }

        /// <summary>
        /// 管理端-编辑排班
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> Update_Arrange(UpdateArrange_Dto dto) {
            var result = await _arrange_Service.Update_Arrange(dto);
            return Ok(result);
        }
    }
}
